//
// Created by lfm on 2025/3/3.
//
//#include <iostream>
//using namespace std;
//class Person
//{
//    friend ostream& operator <<(ostream&out, Person& p);
//
//public:
//    Person(int a, int b)
//    {
//        m_A = a;
//        m_B = b;
//    }
//private:
//    //利用成员函数重载左移运算符  p.operator<<(p)  简化版本p << cout
//    //不会利用成员函数重载<< 运算符，因为无法实现cout在左侧
////    void opetator <<(Person & p)
////    {
//
////
////    }
//    int m_A;
//    int m_B;
//};
////只能利用全局函数来重载
//ostream& operator <<(ostream&out, Person& p)//本质 operator << (cout, p) 简化cout
//{
//    out << "m_A = " << p.m_A << "  " << "m_B = " << p.m_B << endl;
//    return out;
//}
//void test01()
//{
//    Person p(10, 10);
////    p.m_A = 10;
////    p.m_B = 10;
//
//    cout << p << "sdkfs" << endl;
//}
//int main()
//{
//    test01();
//    system("pause");
//    return 0;
//}
#include <iostream>
using namespace std;
class Person
{
    friend ostream& operator <<(ostream& cout, Person& p);
public:
    Person(int a, int b)
    {
        m_A = a;
        m_B = b;
    }
private:
    int m_A;
    int m_B;
};
ostream & operator <<(ostream& cout, Person& p)
{
    cout << p.m_A << "  " << p.m_B << endl;
    return cout;
}
void test01()
{
    Person p(10, 10);
//    p.m_A = 10;
//    p.m_B = 10;
//    cout << p.m_A << "  " <<p.m_B << endl;
    cout << p << "  GUET" << endl;
}
int main()
{
    test01();
    return 0;
}